<?php
    if(file_exists('../../../definitions.inc.php')) include_once('../../../definitions.inc.php');
    include('../../session.inc');
    require_once('../../funct.inc');
    require_once('invoice.inc');
    //--------------------MODUL LOGS--------------------------------------
    if (file_exists("modules/logs/logs.inc"))
	    require_once("modules/logs/logs.inc");
    //--------------------------------------------------------------------
    if(!GetAdminID($ID)){echo LOGIN_ERR;exit;}
    if(!Right_Check(2)){header('Location:error.php');exit;}
    include '../../color_style.php';
    include '../../'.LANGUAGE;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
	    <?php echo '<meta http-equiv="Content-Type" content="text/html; charset='._CHARSET_.';">'; ?>
		<?php 
			include '../../html_style.php';
		?>
	</head>

<?php
	print "<body style=\"background-color:".Background_Color.";\">";

	require_once('../../../classDB.inc.php');
	require_once('../../functs.inc');
	
	do
	{
	    $_DB = new classDB();
            if (!$_DB->open()){echo OPEN_DB_ERR; break;}
		
            $YearFrom = $_REQUEST['YearFrom'];
            $YearTo	  = $_REQUEST['YearTo'];
	    
	    //test spravnosti zadania rokov - duplicitna polozka zaradena z dovodu omylnosti cloveka :-)
		if (!((is_numeric($YearFrom)) and (is_numeric($YearTo)) and ($YearFrom<$YearTo))){
			print "
				<br />
                                <br />
				<b>".INV_CHYBA_ZADANYCH_UDAJOV."</b>
				<br />
				<br />
				".INV_ROKY_MUSIA_BYT_CELE_4CIFERNE_CISLA."
                                <br />
				".INV_HODNOTA_PRECHOD_Z_ROKU_MUSI_BYT_MENSIA_AKO_PRECHOD_DO_ROKU."
				<br />
				<form action=\"invoice_year_switch.php\" method=\"post\" target=\"place\">
                                  <input type=\"submit\" value=\"".INV_ZNOVU_ZADAT_ROKY."\" />
                                </form>				
			";	
		}
		else{  
			$result = Invoice_Year_Switch($YearFrom,$YearTo);
			if ($result=true)  
			    print "
				    <form action=\"invoice_options.php\" method=\"post\" target=\"place\">
				    	<br />
				    	<br />
				    	<b>".INV_ROCNY_PREVOD_USPEsNE_VYKONANY."</b>
						<br />
						<br />
						<b style=\"color:red;\">".INV_POZOR.":</b> 
                                                  ".INV_PRED_DALSIM_POUZIVANIM_JE_POTREBNE_ZMENIT_PREDCISLIE_FAKTURY."
						<br />
						<br />			    	
				    <form action=\"invoice_options.php\" method=\"post\" target=\"place\">
				    	<input type=\"submit\" value=\"".INV_CHCEM_ZMENIT_FAKTURACNE_PREDCISLIE_TERAZ."\" />
				    </form>
			    ";
			else
				print "
					<br />
                                        <br />
					<b>".INV_CHYBA_ZADANYCH_UDAJOV."</b>
					<br />
					<br />
					".INV_ROKY_MUSIA_BYT_CELE_4CIFERNE_CISLA."
					<br />
                                        ".INV_HODNOTA_PRECHOD_Z_ROKU_MUSI_BYT_MENSIA_AKO_PRECHOD_DO_ROKU."
					<br />
					<form action=\"invoice_year_switch.php\" method=\"post\" target=\"place\">
						<input type=\"submit\" value=\"".INV_ZNOVU_ZADAT_ROKY."\" />
                                        </form>
			    ";
		}
	    mysql_close();
	}
	while(false);
?>


</body>
</html>
